//package com.mmtech.edb.data.config;
//
//import com.dangdang.ddframe.job.api.simple.SimpleJob;
//import com.dangdang.ddframe.job.config.JobCoreConfiguration;
//import com.dangdang.ddframe.job.config.simple.SimpleJobConfiguration;
//import com.dangdang.ddframe.job.event.JobEventConfiguration;
//import com.dangdang.ddframe.job.lite.api.JobScheduler;
//import com.dangdang.ddframe.job.lite.config.LiteJobConfiguration;
//import com.dangdang.ddframe.job.lite.spring.api.SpringJobScheduler;
//import com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter;
//import com.mmtech.edb.data.handler.DataHandler;
//import com.mmtech.edb.data.job.DataSendJob;
//import lombok.Data;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//@Configuration
//@ConfigurationProperties(prefix = "dataSendJob")
//@Data
//public class DataSendJobConfig {
//
//    private String jobName;
//    private String cron;
//    private int shardingTotalCount;
//    private String shardingItemParameters;
//    private String jobParameters;
//
//    @Bean
//    public SimpleJob dataSendJob(DataHandler dataHandler) {
//        return new DataSendJob(dataHandler);
//    }
//
//    @Bean(initMethod = "init")
//    public JobScheduler simpleJobScheduler(final ZookeeperRegistryCenter regCenter, final SimpleJob simpleJob, final JobEventConfiguration jobEventConfiguration) {
//        return new SpringJobScheduler(simpleJob, regCenter, getLiteJobConfiguration(jobName, simpleJob.getClass(),
//                cron, shardingTotalCount, shardingItemParameters, jobParameters), jobEventConfiguration);
//    }
//
//    private LiteJobConfiguration getLiteJobConfiguration(final String jobName, final Class<? extends SimpleJob> jobClass,
//                                                         final String cron,
//                                                         final int shardingTotalCount,
//                                                         final String shardingItemParameters,
//                                                         final String jobParameters) {
//        // 定义作业核心配置
//        JobCoreConfiguration simpleCoreConfig = JobCoreConfiguration.newBuilder(jobName, cron, shardingTotalCount).
//                shardingItemParameters(shardingItemParameters).jobParameter(jobParameters).build();
//        // 定义SIMPLE类型配置
//        SimpleJobConfiguration simpleJobConfig = new SimpleJobConfiguration(simpleCoreConfig, jobClass.getCanonicalName());
//        // 定义Lite作业根配置
//        return LiteJobConfiguration.newBuilder(simpleJobConfig).overwrite(true).build();
//
//    }
//}